import React, { FC } from "react";
import { Typography } from "antd";
import { CaretLeftOutlined } from "@ant-design/icons";
import { history } from "umi";
const { Title } = Typography
const MyTitle: FC<any> = ({
    level,
    title,
    back,
}) => {
    return (
        <div style={{ display: 'flex', alignItems: 'center' }}>
            <Title level={level} style={{ color: "#f50", margin: 0 }}>
                {title}
            </Title>
            {
                back && <CaretLeftOutlined onClick={() => history.go(-1)} style={{ color: '#f50', margin: 0, fontSize: 20, cursor: 'pointer' }} />
            }
        </div>
    )
}

MyTitle.defaultProps = {
    level: 5,
    title: '',
    back: true
}

export default MyTitle
